#ifndef __WIZ_BNF_DIERECTIVE_INHIBITCASE_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_DIERECTIVE_INHIBITCASE_HPP__SHANHAOBO_19800429__

#include "../Parser/WizBNFParserUnary.hpp"
#include "../Parser/WizBNFParserString.hpp"
#include "../Parser/WizBNFParserCharCheck.hpp"

namespace Wiz
{
    namespace BNF
    {
        namespace Directive
        {
            namespace InhibitCase
            {
                namespace Policy
                {
                    namespace Iteration
                    {
                        template <typename BaseT>
                        struct Type : public BaseT
                        {
                            typedef BaseT   tSuper;
                            Type() : tSuper()
                            {}
                            template <typename PolicyT>
                            Type(PolicyT const& Other) : tSuper(Other)
                            {}
                            template <typename CharT>
                            CharT Filter(CharT ch) const
                            {
                                return ::Wiz::ToLower(ch);
                            }
                        };
                    } /// end of namespace Iteration
                } /// end of namespace Policy

                template <typename ResultT, typename ParserT, typename ScannerT>
                WIZ_INLINE ResultT ParserParse(
                    ParserT const&  InParser,
                    ScannerT const& Scan,
                    ::Wiz::BNF::Policy::Iteration const&
                    )
                {
                    typedef ::Wiz::BNF::Policy::Scanner<
                        ::Wiz::BNF::Directive::InhibitCase::Policy::Iteration::Type<typename ScannerT::tIterationPolicy>,
                        typename ScannerT::tMatchPolicy,
                        typename ScannerT::tActionPolicy
                    > tPolicies;

                    return InParser.Parse(Scan.ChangePolicies(tPolicies(Scan)));
                }

                template <typename ResultT, typename ParserT, typename ScannerT, typename BaseT>
                WIZ_INLINE ResultT ParserParse(
                    ParserT const& InParser,
                    ScannerT const& Scan,
                    ::Wiz::BNF::Directive::InhibitCase::Policy::Iteration::Type<BaseT> const&
                    )
                {
                    return InParser.Parse(Scan);
                }

                template <typename ParserT>
                struct Type : public ::Wiz::BNF::Parser::Unary::Type<ParserT, ::Wiz::BNF::Parser::Type<Type<ParserT>>>
                {
                    typedef Type<ParserT>                                                                       tThis;
                    typedef ::Wiz::BNF::Parser::Unary::Type<ParserT, ::Wiz::BNF::Parser::Type<Type<ParserT>>>   tSuper;
                    typedef struct ParserGenerator                                                              tGenerator;

                    template <typename ScannerT>
                    struct Result
                    {
                        typedef typename ::Wiz::BNF::Parser::Result<ParserT, ScannerT>::tType tType;
                    };

                    Type(ParserT const& Prsr) : tSuper(Prsr)
                    {
                    }

                    template <typename ScannerT>
                    typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType
                    ParseImpl(ScannerT const& Scan) const
                    {
                        typedef typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType tResult;
                        return ::Wiz::BNF::Directive::InhibitCase::ParserParse<tResult>(this->Subject(), Scan, Scan);
                    }
                };

                struct ParserGeneratorBase
                {
                    typedef ::Wiz::BNF::Directive::InhibitCase::Type<::Wiz::BNF::Parser::String::Type<::Wiz::Char::ConstPtr>>   tInhibitCaseCharPtr;
                    typedef ::Wiz::BNF::Directive::InhibitCase::Type<::Wiz::BNF::Parser::String::Type<::Wiz::WChar::ConstPtr>>  tInhibitCaseWCharPtr;
                    typedef ::Wiz::BNF::Directive::InhibitCase::Type<::Wiz::BNF::Parser::Char::Check::Type<::Wiz::Char::Type>>  tInhibitCaseChar;
                    typedef ::Wiz::BNF::Directive::InhibitCase::Type<::Wiz::BNF::Parser::Char::Check::Type<::Wiz::WChar::Type>> tInhibitWCaseChar;

                    static tInhibitCaseCharPtr Generate(::Wiz::Char::ConstPtr StrPtr)
                    {
                        return tInhibitCaseCharPtr(StrPtr);
                    }
                    static tInhibitCaseWCharPtr Generate(::Wiz::WChar::ConstPtr str)
                    {
                        return tInhibitCaseWCharPtr(str);
                    }
                    static tInhibitCaseChar Generate(::Wiz::Char::In ch)
                    {
                        return tInhibitCaseChar(ch);
                    }
                    static tInhibitWCaseChar Generate(::Wiz::WChar::In ch)
                    {
                        return tInhibitWCaseChar(ch);
                    }
                    template <typename ParserT>
                    static ::Wiz::BNF::Directive::InhibitCase::Type<ParserT> Generate(::Wiz::BNF::Parser::Type<ParserT> const& InSub)
                    {
                        return ::Wiz::BNF::Directive::InhibitCase::Type<ParserT>(InSub.Derived());
                    }

                    tInhibitCaseCharPtr operator[](::Wiz::Char::ConstPtr str) const
                    {
                        return tInhibitCaseCharPtr(str);
                    }
                    tInhibitCaseWCharPtr operator[](::Wiz::WChar::ConstPtr str) const
                    {
                        return tInhibitCaseWCharPtr(str);
                    }
                    tInhibitCaseChar operator[](::Wiz::Char::In ch) const
                    {
                        return tInhibitCaseChar(ch);
                    }
                    tInhibitWCaseChar operator[](::Wiz::WChar::In ch) const
                    {
                        return tInhibitWCaseChar(ch);
                    }
                    template <typename ParserT>
                    ::Wiz::BNF::Directive::InhibitCase::Type<ParserT> operator[](::Wiz::BNF::Parser::Type<ParserT> const& InSub) const
                    {
                        return ::Wiz::BNF::Directive::InhibitCase::Type<ParserT>(InSub.Derived());
                    }
                };

                //////////////////////////////////
                struct ParserGenerator : public ParserGeneratorBase
                {
                    ParserGenerator()
                    {}
                };
            } /// end of namespace InhibitCase
            namespace Predef
            {
                namespace InhibitCase
                {
                    const ::Wiz::BNF::Directive::InhibitCase::ParserGenerator AsLower = ::Wiz::BNF::Directive::InhibitCase::ParserGenerator();
                } /// end of namespace InhibitCase
            } /// end of namespace Predef
        } /// end of namespace Directive
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_DIERECTIVE_INHIBITCASE_HPP__SHANHAOBO_19800429__*/
